#pragma once
#ifndef _SERVER_MAIN_HPP_
#define _SERVER_MAIN_HPP_
#include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/epoll.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/select.h>

#define BUF_SIZE 512
#define MAX_EVENTS 64
#define SERVER_PORT 9999
#define SERVER_ADDRESS "127.0.0.1"
#define ERROR_FUNC(fd,str)  if( (fd) ) { perror( (str) ); abort();}

enum class CLIENT_TYPE
{
	NONE = 0,
	REGISTER = 1,
	CHAT = 2,
	LOGOUT = 3,
};

typedef struct _tCLIENTDATA
{
	CLIENT_TYPE type;
	const char* name;
	int fd;
}ClientData, * pClientData;

int set_noblocking(int sockfd);
#endif /*_SERVER_MAIN_HPP_*/